#!/usr/bin/env bash
#dev-install.sh

set -e

if [[ $EUID -ne 0 ]]; then
   echo "Please execute this installation script with a superuser..." 1>&2
   exit 1
fi

echo "
    let's begin install...
"

YUM_CMD=$(which yum)
APT_GET_CMD=$(which apt-get)

if [[ ! -z $APT_GET_CMD ]]; then
    bash apt/dev-install.sh
elif [[ ! -z $YUM_CMD ]]; then
    bash rhel/dev-install.sh
else
    echo "error can't install..."
    exit 1;
fi

echo "lantern ..."
git https://git.oschina.net/truthbean/lantern.git
cd lantern
make lantern

echo "installing jetbrain datagrip, after installed, you can active it using http://idea.hbnu.top license server"
wget -c https://download.jetbrains.8686c.com/datagrip/datagrip-2016.2.3.tar.gz
sudo cp datagrip-2016.2.3.tar.gz /opt && cd /opt
sudo tar -xvzf datagrip-2016.2.3.tar.gz
sudo rm datagrip-2016.2.3.tar.gz